package com.content.Service.Impl.drama;

import com.content.Entity.drama.Video;
import com.content.Mapper.drama.VideoMapper;
import com.content.Service.drama.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class VideoServiceImpl implements VideoService {
    @Autowired
    private VideoMapper videoMapper;

    @Override
    public void addVideo(Video video) {
        video.setVideoId(makeId());
        videoMapper.addVideo(video);
    }

    private String makeId() {
        return "DV" + System.currentTimeMillis();
    }

    @Override
    public void updateVideo(Video video) {
        videoMapper.updateVideo(video);
    }

    @Override
    public void deleteVideo(String videoId) {
        videoMapper.deleteVideo(videoId);
    }
}
